package PostProcessing;

import java.awt.Color;
import java.awt.Graphics;

import Main.SpaceGame;
import World.TileType;
import World.World;

public class OxygenPostProcessing 
{
	private SpaceGame main;
	
	public OxygenPostProcessing(SpaceGame main)
	{
		this.main = main;
	}
	
	public void draw(Graphics g)
	{
		for(int x = main.camera.getPixelX()/10;x<(main.camera.getPixelX()+SpaceGame.windowXSize)/10;x++)
		{
			for(int y = main.camera.getPixelY()/10;y<(main.camera.getPixelY()+SpaceGame.windowYSize)/10;y++)
			{
				if(x<World.worldXSize && y<World.worldYSize)
				{
					if(main.world.tiles[x][y].getType() == TileType.Interior && main.world.tiles[x][y].getOxygen()<=80)
					{
						g.setColor(new Color(255,50,50,(int)(Math.abs(200-main.world.tiles[x][y].getOxygen()*2+.5))));
						g.fillRect(x*10, y*10, 10, 10);
					}
				}
			}
		}
	}
}
